﻿using SmartHRMS.Infrastructure;
using System.Collections;
using System.Security.Principal;

namespace SmartHRMS.Model.Account
{
    public class Principal : BusinessBase<Principal>, IAggregateRoot, IEntity,System.Security.Principal.IPrincipal
    {

        IIdentity identity { get; set; }
        ArrayList permissionList { get; set; }
        ArrayList roleList { get; set; }

        #region IPrincipal Members

        public System.Security.Principal.IIdentity Identity
        {
            get { 
                return identity;
            }
            set
            {
                identity = value;
            }
        }

        public bool IsInRole(string role)
        {
            return roleList.Contains(role);
        }

        public ArrayList Roles
        {
            get
            {
                return roleList;
            }
        }

        public ArrayList Permissions
        {
            get
            {
                return permissionList;
            }
        }

        #endregion

        public override void validate()
        {
            throw new System.NotImplementedException();
        }
    }
}
